<%@ page language="java" contentType="text/html; charset=UTF-8"   pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<style type="text/css">
a {
	color:#222;
	text-decoration:none;
}
ul {
	list-style:none;
	padding-left:0;
	margin-left:0px
}
ul li {
	list-style-position:inside;
	list-style-type:none;
	margin:0;
	padding:0;
}
ol li {
	list-style-position:inside;
}
</style>
<div class="not_right" >
	<div class="not_righttitle">
		<div class="not_righttitle01"> <a href="#">职业规划</a> </div>
		<div class="not_righttb">
			<div class="exam_title"> <a href="javascript:getTeacherDiv('career');">
				<div class="exam_title02"> 待规划学员 </div>
				</a> <a href="javascript:getUrlDiv('/teacher/career/planed');">
				<div class="exam_title01"> 已规划学员 </div>
				</a></div>
		</div>
		
		<!--上传规划学员-->
		<c:forEach items="${plannedList}" var="studentItem">
			<div class="teac_member" style="margin-top:20px;">
				<div class="teac_memberlist">
					<div class="notic_rightmid0200">
						<div class="notic_rightmid02l" style="position:relative;float:left">
							<c:if test="${not empty studentItem['student_head']}"><img src="${drmFilePath}cdrmimg/${studentItem['student_head']}?w=70&h=70" style="height:50px;width:50px;"/></c:if>
						</div>
						${studentItem["student_name"]} </div>
					<div class="plan_rightlist" style="width:500px;text-align:left;">
						<ul>
							<c:forEach items="${studentItem['plannings']}" var="planning">
								<li> <span style="margin-left:10px;"> <img src="../images/pdficon.png"> </span> <a href="/drmdown/${planning['planning_id']}?fnm=${planning['plan_name']}" onclick="downloadCareer('${planning['id']}')">${planning['plan_name']}</a> <span style="margin-left:20px;font-size:12px;"> BY: <a href="#" style="color:#275D7E"> ${planning['teacher_name']} </a> </span> 
								<a href="javascript:void(0);" onclick="deleteCareerPlan('${planning['id']}')"> <span style="margin-left:10px; color:#0A8CD2;font-size:12px"> 删除 </span>
								</a></li>
							</c:forEach>								
						</ul>
					</div>
					<div class="teac_memberlistl" style="float:right;margin-right:30px;">
						<div class="teac_studdy">
							<div class="opac" style="width:60px;overflow:hidden;">
								<form>
									<input type="file" name="upload" onchange="return ajaxFileUpload('${studentItem['student_id']}','${studentItem['class_id']}',this);" />
								</form>
							</div>
							上传规划</div>
					</div>
				</div>
				
			</div>
		</c:forEach>		
		
		<!--end已上传规划学员--> 	
	</div>	
</div>
<script type="text/javascript" src="${jspath}/js/ajaxfileupload.js"></script>
<script type="text/javascript">
function downloadCareer(careerid){
	//alert('download:'+careerid);
	//下载数增加1
	$.ajax({
      	 url : '/teacher/career/download_carrer/'+careerid,
      	 dataType : 'json',
      	 success : function(d,status){
      		
      	 }
   });
}
function deleteCareerPlan(careerid){
	if(confirm('确定删除吗？')){
		$.ajax({
	       	 url : '/teacher/career/delete_carrer/'+careerid,
	       	 dataType : 'json',
	       	 success : function(d,status){
	       		 //alert('success');
	       		 if(d.success){
	       			getUrlDiv('/teacher/career/planed');
	       		 } else {
	       			 alert('删除失败！');
	       		 }
	       	 }
        });
	}
}
function ajaxFileUpload(studentid,classid,m){
	/* $("#"+studentid+classid+"loading")
	.ajaxStart(function(){
		$(this).show();
	})
	.ajaxComplete(function(){
		$(this).hide();
	}); */
	//alert(studentid);
	//return;
	$(m).attr('id','file');
	$.ajaxFileUpload({
			url:'/drm/att/up?token=12qwaszxcvdfer34',
			secureuri:false,
			fileElementId:'file',
			dataType: 'json',				
			success: function (data, status){         
				//debugger;
				$(m).removeAttr('id');
				if(typeof(data.code) != 1){
                     //alert(data.filename);
                     //return;
                     $.ajax({
                    	 url : '/teacher/career/save_career_plan',
                    	 data : {classid:classid,studentid:studentid,planName:data.filename,planid:data.id},
                    	 dataType : 'json',
                    	 success : function(d,status){
                    		 //alert('success');
                    		 if(d.success)
                    		 	getUrlDiv('/teacher/career/planed');
                    		 else
                    			 alert('上传失败！');
                    	 }
                     });
                }
			},
			error: function (data, status, e){
				$(m).removeAttr('id');
				alert(e);
			}
		}
	)	
	return false;
}
</script>